package org.ling.xuan.entity.mo;

import cn.hutool.core.io.FileUtil;


public class SvnCommitCheck {
    private String unionCommitPath;
    private String projectPath;
    private final String fileName;
    private final String filePath;
    // 0.错误 1.可以提交 2.警告
    private int checkStatus = 1;
    private String msg;
    private boolean svnFile;
    private String modifyStatus;

    public String getUnionCommitPath() {
        return unionCommitPath;
    }

    public void setUnionCommitPath(String unionCommitPath) {
        this.unionCommitPath = unionCommitPath;
    }

    public String getModifyStatus() {
        return modifyStatus;
    }

    public void setModifyStatus(String modifyStatus) {
        this.modifyStatus = modifyStatus;
    }

    public SvnCommitCheck(String file) {
        this.filePath = file;
        this.fileName = FileUtil.getName(filePath);
    }

    public String getProjectPath() {
        return projectPath;
    }

    public void setProjectPath(String projectPath) {
        this.projectPath = projectPath;
    }

    public String getFileName() {
        return fileName;
    }

    public String getFilePath() {
        return filePath;
    }

    public int getCheckStatus() {
        return checkStatus;
    }

    public String getMsg() {
        return msg;
    }

    public boolean isSvnFile() {
        return svnFile;
    }

    public void setSvnFile(boolean svnFile) {
        this.svnFile = svnFile;
    }

    public void success(String msg) {
        if (this.checkStatus != 0 && this.checkStatus != 2) {
            this.checkStatus = 1;
            this.msg = msg;
        }
    }

    public void warn(String msg) {
        if (this.checkStatus != 0) {
            this.checkStatus = 2;
            this.msg = msg;
        }
    }

    public void error(String msg) {
        this.checkStatus = 0;
        this.msg = msg;
    }


}
